package com.liujg.future.model.entity;

import com.liujg.future.model.resp.OrderGoods;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.math.BigDecimal;
import java.util.List;

@Document("order_info")
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Order {

    /**
     * {
     * 	"id": "1829170326055948290",
     * 	"createTime": "2024-08-29 22:52:45",
     * 	"payType": 1,
     * 	"orderState": 1,
     * 	"payLatestTime": "2024-08-29 23:22:45",
     * 	"countdown": 1799,
     * 	"postFee": 3.00,
     * 	"payMoney": 727.00,
     * 	"payChannel": 2,
     * 	"payState": 1,
     * 	"totalMoney": 724.00,
     * 	"totalNum": 3,
     * 	"deliveryTimeType": 1,
     * 	"receiverContact": "ls",
     * 	"receiverMobile": "43725472",
     * 	"provinceCode": "130000",
     * 	"cityCode": "130100",
     * 	"countyCode": "130102",
     * 	"receiverAddress": "河北省 石家庄市 长安区gsfsd",
     * 	"payTime": null,
     * 	"consignTime": null,
     * 	"endTime": null,
     * 	"closeTime": null,
     * 	"evaluationTime": null,
     * 	"skus": [{
     * 		"id": "1829170326068531201",
     * 		"spuId": "4008506",
     * 		"name": "平步青云财神家居摆件",
     * 		"quantity": 1,
     * 		"image": "https://yanxuan-item.nosdn.127.net/9d5d0083264344b5d85acde13570d025.jpg",
     * 		"realPay": 646.00,
     * 		"curPrice": 646.00,
     * 		"totalMoney": null,
     * 		"properties": [{
     * 			"propertyMainName": "规格",
     * 			"propertyValueName": "小桃仙"
     * 		        }],
     * 		"attrsText": "小桃仙"    * 	}, {
     * 		"id": "1829170326072725505",
     * 		"spuId": "3847005",
     * 		"name": "浓缩的精华，宠物化毛营养膏120克/支",
     * 		"quantity": 2,
     * 		"image": "https://yanxuan-item.nosdn.127.net/a36c88ef48b14320166fab465686479f.jpg",
     * 		"realPay": 78.00,
     * 		"curPrice": 39.00,
     * 		"totalMoney": null,
     * 		"properties": [{
     * 			"propertyMainName": "规格",
     * 			"propertyValueName": "120克/支"
     * 		}        ],
     * 		"attrsText": "120克/支"
     *    }],
     * 	"arrivalEstimatedTime": null
     * }
     */
    /**
     * 订单ID
     */
    private String id;
    private String userId;
    /**
     * 创建时间 格式：yyyy-MM-dd HH:mm:ss
     */
    private String createTime;
    /**
     * 支付方式，1为在线支付，2为货到付款
     */
    private Integer payType = 1;
    /**
     * 订单状态，1为待付款、2为待发货、3为待收货、4为待评价、5为已完成、6为已取消
     */
    private Integer orderState = 1;
    /**
     * 付款截止时间：剩余的秒数，前台转换成分钟：秒数
     */
    private String payLatestTime;
    /**
     * 倒计时--剩余的秒数 -1 表示已经超时，正数表示倒计时未结束
     */
    private Integer countdown;
    /**
     * 邮费
     */
    private BigDecimal postFee = new BigDecimal(3);
    /**
     * 实付金额 = 商品总价 + 邮费 - 折扣
     */
    private BigDecimal payMoney;
    /**
     * 支付渠道，1支付宝、2微信
     */
    private Integer payChannel=2;
    /**
     * todo
     */
    private Integer payState = 1;
    /**
     * 金额合计 商品总金额
     */
    private BigDecimal totalMoney;
    /**
     * 数量合计
     */
    private Integer totalNum;
    /**
     * 配送时间类型，1为不限，2为工作日，3为双休或假日
     */
    private Integer deliveryTimeType = 1;
    /**
     * 收货人
     */
    private String receiverContact;
    /**
     * 收货人手机
     */
    private String receiverMobile;
    /**
     * 省份编码
     */
    private String provinceCode;
    /**
     * 城市编码
     */
    private String cityCode;
    /**
     * 县区编码
     */
    private String countyCode;
    /**
     * 收货人地址 fullAddress + address
     */
    private String receiverAddress;
    /**
     * 付款时间
     */
    private String payTime;
    /**
     * 发货时间
     */
    private String consignTime;
    /**
     * 交易完成时间
     */
    private String endTime;
    /**
     * 交易关闭时间
     */
    private String closeTime;
    /**
     * 完成评价时间
     */
    private String evaluationTime;
    /**
     * 商品集合
     */
    private List<OrderSku> skus;
    /**
     * 预计到货时间
     */
    private String arrivalEstimatedTime;

    @Data
    public static class OrderSku {
        /**
         * skuId
         */
        private String id;
        private String spuId;
        private String name;
        /**
         * 数量
         */
        private Integer quantity;
        /**
         * 图片地址
         */
        private String image;
        /**
         * 实付金额
         */
        private BigDecimal realPay;
        /**
         * 单价
         */
        private BigDecimal curPrice;
        /**
         * 小计
         */
        private BigDecimal totalMoney;
        /**
         * 属性集合
         */
        private List<Property> properties;
        /**
         * 属性说明
         */
        private String attrsText;
    }

    @Data
    public static class Property {
        /**
         * 属性名称，如 颜色
         */
        private String propertyMainName;
        /**
         * 属性值名称，如 黑色
         */
        private String propertyValueName;
    }

}
